/*
 * The UserBean.java created for spikeCASservice projects. 
 */
package com.google.code.sip.ucenter.model;

import java.util.Date;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Indexed;
import com.google.code.morphia.annotations.Reference;

/**
 * 登录账号实体类
 * 
 * @author Liuye
 * @version 1.0 2010-5-27
 */
@Entity(noClassnameStored = true)
@SuppressWarnings("serial")
public class User extends BaseEntity {
	/**
	 * 用户名/登录名
	 */
	@Indexed(unique = true)
	private String username;

	/**
	 * 密码
	 */
	private String password;

	/**
	 * 昵称
	 */
	private String nickName;

	/**
	 * 邮箱
	 */
	@Indexed
	private String email;

	/**
	 * 头像
	 * 
	 * 头像图片的url
	 */
	private String avatar;

	/**
	 * 是否可用
	 */
	@Indexed
	private boolean enabled = true;

	/**
	 * 是否锁定
	 */
	@Indexed
	private boolean locked = false;

	/**
	 * 是否系统内置用户,系统内置用户不能删除
	 */
	private boolean buildin = false;

	/**
	 * 是否已删除
	 */
	private boolean deleted = false;

	/**
	 * 删除日期
	 */
	private Date deletedDate;

	@Reference
	private Role role;// 有序的关联对象集合
	/**
	 * 创建日期
	 */
	private Date createdDate = new Date();

	/**
	 * 最后登录日期
	 */
	@Indexed
	private Date latestLoginDate;

	/**
	 * 最后更新日期
	 */
	@Indexed
	private Date latestUpdatedDate;

	private String questionId;

	private String answer;

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username
	 *            the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	public boolean isBuildin() {
		return buildin;
	}

	public void setBuildin(boolean administrable) {
		this.buildin = administrable;
	}

	/**
	 * @return the nickName
	 */
	public String getNickName() {
		return nickName;
	}

	/**
	 * @param nickName
	 *            the nickName to set
	 */
	public void setNickName(String nickname) {
		this.nickName = nickname;
	}

	/**
	 * @return the createdDate
	 */
	public Date getCreatedDate() {
		return createdDate;
	}

	/**
	 * @param createdDate
	 *            the createdDate to set
	 */
	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enalbe) {
		this.enabled = enalbe;
	}

	public boolean isLocked() {
		return locked;
	}

	public void setLocked(boolean locked) {
		this.locked = locked;
	}

	public Date getLatestLoginDate() {
		return latestLoginDate;
	}

	public void setLatestLoginDate(Date latestLoginDate) {
		this.latestLoginDate = latestLoginDate;
	}

	public Date getLatestUpdatedDate() {
		return latestUpdatedDate;
	}

	public void setLatestUpdatedDate(Date latestUpdatedDate) {
		this.latestUpdatedDate = latestUpdatedDate;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email
	 *            the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return the avatar
	 */
	public String getAvatar() {
		return avatar;
	}

	public String getQuestionId() {
		return questionId;
	}

	public void setQuestionId(String questionId) {
		this.questionId = questionId;
	}

	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}

	/**
	 * @param avatar
	 *            the avatar to set
	 */
	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public Date getDeletedDate() {
		return deletedDate;
	}

	public void setDeletedDate(Date deletedDate) {
		this.deletedDate = deletedDate;
	}
}